/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cards;

import enums.CardTypes;
import enums.LimitedCardTypes;

/**
 *
 * @author Oksana_Moroz
 */
public class LimitedCard extends Card {

    protected int tripsLeft;
    protected LimitedCardTypes limitedCardTypes;
    
    public LimitedCard(long id, CardTypes type, LimitedCardTypes limitedCardTypes) {
        super(id, type);        
        this.limitedCardTypes = limitedCardTypes;
        this.tripsLeft = limitedCardTypes.getTripsQuantity();
    }
    
    @Override
    public boolean makeTrip() {
        if (tripsLeft > 0) {
            tripsLeft--;
            return true;
        } else {
            return false;
        }
    } 
    
    @Override
    public String toString() {
        return "" + limitedCardTypes.getTripsQuantity() + "-trips limited card, id = " + id + ", type = " + type;
    }
}
